#include <iostream>
#include "Effect.h"
#include "Drawable.h"

using namespace std;
using namespace JDL;

Drawable::Drawable()
{
  _surface = NULL;
  this->InitRect(&_clipper);
  this->InitRect(&_pos);
  this->InitRect(&_old_pos);
  this->InitRect(&_pos_c);
}

Drawable::~Drawable()
{
}

SDL_Rect	Drawable::GetPosition() const
{
  return (_pos);
}

void		Drawable::SetPosition(int x, int y)
{
  _pos.x = x;
  _pos.y = y;
}

void		Drawable::SetSubRect(int x, int y, int w, int h)
{
  _zone.x = x;
  _zone.y = y;
  _zone.w = w;
  _zone.h = h;
}

void		Drawable::InitRect(SDL_Rect *rect)
{
  rect->x = 0;
  rect->y = 0;
  rect->w = 0;
  rect->h = 0;
}		

SDL_Rect	Drawable::GetSubRect() const
{
  return (_zone);
}

SDL_Rect	Drawable::GetSizeSurface()
{
  SDL_Rect	rect;

  rect.w = _surface->w;
  rect.h = _surface->h;
  return (rect);
}

void		Drawable::AddEffect(string name, Effect *effect)
{
  _effect[name] = effect;
}

void		Drawable::DelEffect(string name)
{
  _effect.erase(name);
}
